package org.study.mongo.boot.domain;

import lombok.Data;
import org.springframework.data.annotation.*;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 类的描述
 *
 * @author Administrator
 * @date 2021-05-21
 */
@Data
@Document(collection = Employee.COL_NAME)
public class Employee implements Serializable {
    private static final long serialVersionUID = 4112855196065463736L;

    /**
     * 实体类对应的集合名称
     */
    public static final String COL_NAME = "col_employee";

    @Id
    @Field(value = "_id")
    private String id;

    @Field
    private String name;

    @Field
    private Integer level;

    @Field
    private BigDecimal salary;

    @Field
    private LocalDate birthday;

    @Field(name = "create_by")
    @CreatedBy
    private String createBy;

    @Field(name = "create_time")
    @CreatedDate
    private LocalDateTime createTime;

    @Field(name = "update_by")
    @LastModifiedBy
    private String lastModifiedBy;

    @Field(name = "update_time")
    @LastModifiedDate
    private LocalDateTime updateTime;
}
